package com.lingyu.jsjx.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.lingyu.jsjx.domain.SupervisorEvaluation;
import com.lingyu.jsjx.service.ISupervisorEvaluationService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 督导评价Controller
 * 
 * @author ruoyi
 * @date 2025-08-08
 */
@RestController
@RequestMapping("/supervisorEvaluation")
public class SupervisorEvaluationController extends BaseController
{
    @Autowired
    private ISupervisorEvaluationService supervisorEvaluationService;

    /**
     * 查询督导评价列表
     */
    @RequiresPermissions("jsjx:supervisorEvaluation:list")
    @GetMapping("/list")
    public TableDataInfo list(SupervisorEvaluation supervisorEvaluation)
    {
        startPage();
        List<SupervisorEvaluation> list = supervisorEvaluationService.selectSupervisorEvaluationList(supervisorEvaluation);
        return getDataTable(list);
    }

    /**
     * 导出督导评价列表
     */
    @RequiresPermissions("jsjx:supervisorEvaluation:export")
    @Log(title = "督导评价", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SupervisorEvaluation supervisorEvaluation)
    {
        List<SupervisorEvaluation> list = supervisorEvaluationService.selectSupervisorEvaluationList(supervisorEvaluation);
        ExcelUtil<SupervisorEvaluation> util = new ExcelUtil<SupervisorEvaluation>(SupervisorEvaluation.class);
        util.exportExcel(response, list, "督导评价数据");
    }

    /**
     * 获取督导评价详细信息
     */
    @RequiresPermissions("jsjx:supervisorEvaluation:query")
    @GetMapping(value = "/{supervisorEvalId}")
    public AjaxResult getInfo(@PathVariable("supervisorEvalId") Long supervisorEvalId)
    {
        return success(supervisorEvaluationService.selectSupervisorEvaluationBySupervisorEvalId(supervisorEvalId));
    }

    /**
     * 新增督导评价
     */
    @RequiresPermissions("jsjx:supervisorEvaluation:add")
    @Log(title = "督导评价", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SupervisorEvaluation supervisorEvaluation)
    {
        return toAjax(supervisorEvaluationService.insertSupervisorEvaluation(supervisorEvaluation));
    }

    /**
     * 修改督导评价
     */
    @RequiresPermissions("jsjx:supervisorEvaluation:edit")
    @Log(title = "督导评价", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SupervisorEvaluation supervisorEvaluation)
    {
        return toAjax(supervisorEvaluationService.updateSupervisorEvaluation(supervisorEvaluation));
    }

    /**
     * 删除督导评价
     */
    @RequiresPermissions("jsjx:supervisorEvaluation:remove")
    @Log(title = "督导评价", businessType = BusinessType.DELETE)
	@DeleteMapping("/{supervisorEvalIds}")
    public AjaxResult remove(@PathVariable Long[] supervisorEvalIds)
    {
        return toAjax(supervisorEvaluationService.deleteSupervisorEvaluationBySupervisorEvalIds(supervisorEvalIds));
    }
}
